package com.syq.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.syq.mapper.DtsGoodsAttributeMapper;
import com.syq.pojo.DtsGoodsAttribute;
import com.syq.service.DtsGoodsAttributeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

/**
 * @ClassName: DtsGoodsAttributeServiceImpl
 * @Description: TODO
 * @Create by: syq
 * @Date: 2022/7/23 10:31
 */

@Service
@Transactional
public class DtsGoodsAttributeServiceImpl implements DtsGoodsAttributeService {

    @Autowired
    private DtsGoodsAttributeMapper goodsAttributeMapper;

    @Override
    public List<DtsGoodsAttribute> findById(Integer id) {
        return goodsAttributeMapper.selectList(new QueryWrapper<DtsGoodsAttribute>().eq("goods_id",id));
    }

    @Override
    public void add(DtsGoodsAttribute attribute) {
        goodsAttributeMapper.insert(attribute);
    }

    @Override
    public void deleteById(Integer id) {
        goodsAttributeMapper.delete(new QueryWrapper<DtsGoodsAttribute>().eq("goods_id",id));
    }
}
